<?php
/**
 * @version        $Id: admin_files_ok.php 2014年8月20日Z yeshili $
 * @package        YeshiliCMS.Admin
 * @copyright      Copyright (c) 2014 - 2050, YeshiliCMS, Inc.
 * @license        http://help.****.com/YeshiliCMS/help.html
 * @link           http://www.****.com
 */
include '../inc/config.php';
require 'admin_session.php'; 
$act = getvar('act');
$id = getvar('id');
//删除
if ($act=='del') {
	get_delfile0($id);
	get_record('【附件】'.get_field('files','title','id',$id),'del');
	$file=$db->delete($GLOBALS[dbprefix].'files',"id=".$id);
	if($file){
	    echo "<script>alert('删除成功!');history.go(-1);</script>";
	}
	else{
		echo "<script>alert('删除失败!');history.go(-1);</script>";
	}
}
//多选删除
if ($act=='delcheck') {
	$arr=array();
	$arr =$_POST['ck'];
	if(!empty($arr)){
	  foreach ($arr as $v){
		  get_delfile0($v);
		  get_record('【附件】'.get_field('files','title','id',$v),'del');
		  $db->delete($GLOBALS[dbprefix].'files',"id=".$v);
	  }
	  echo "<script>alert('删除成功!');history.go(-1);</script>";
	}else
	{
	  echo "<script>alert('删除失败!');history.go(-1);</script>";
	}
}
?>
